﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using vensoft.Entities;
using vensoft.BussinesLogic;

namespace vensoft.Win32
{
    public partial class frmAEAlmacen : Form
    {
        IAlmacenBL almacenBL;

        public frmAEAlmacen()
        {
            InitializeComponent();
            almacenBL = new AlmacenBL();
        }

        public Almacen CurrentAlm { get; set; }

        public void Editar()
        {
            almacenBindingSource.DataSource = CurrentAlm;

        }

        public void Nuevo()
        {
            Almacen currentAlm = almacenBindingSource.Current as Almacen;
            almacenBindingSource.AddNew();
            currentAlm = null;

        }
        private void btnCancelar_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("¿Guardar Información?", "CONFIRMACIÓN", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                MessageBox.Show("¡Información Guardada Satisfactoriamente!", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Almacen currentAlm = almacenBindingSource.Current as Almacen;
                almacenBL.RegistrarAlmacen(currentAlm);

                this.Close();
            }
        }


    }
}
